
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
        <script src="js/jquery-1.7.1.min.js" type="text/javascript"></script>
        <script>
            $(function(){
                $('#form').submit((e)=>{//get the form
                    e.preventDefault();//prevent the default submit
                    $.ajax({
                        url:'/',
                        type:'post',
                        contentType:'application/json',
                        data: JSON.stringify($('#form').serializeArray()), //make data in an array
                        success: (response)=>{
                            console.log('Successfully got response');
                            console.log(response);
                        }
                    });
                });
            });
        </script>
	</head>
	<body>
        <form action="/" method="post" id="form">
            <div class="form-group">
                <label for="email">Email addressesd:</label>
                <input type="email" class="form-control" name="email"/>
            </div>
            <div class="form-group">
                <label for="pwd">Password:</label>
                <input type="password" class="form-control" name="password"/>
            </div>
            <button type="submit" class="btn btn-default">Submit</button>
        </form>
	</body>
</html>
